<div class="cont" style="overflow:hidden;">
    <div class="position ">
        <img alt="位置图标" src="dist/images/position.png"/>系统管理&gt;岗位管理
    </div>
    <div class="mybackground" style="overflow:hidden;">
        <div class="cont_fr_top">
            <div class="menus_top">
                <div class="menus_l">岗位管理(点击节点进行编辑)</div>
                <div class="cont_fr_btn">
                    <div class="fr">
                        <button class="cont_f_btn3" ng-click="showAdd()" >添加岗位</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="menus">
        <div class="ui grid row" style="margin-top:1.2em;margin-left:0.33em;">
            <div class="ui big list" list-tree tree-nodes="roles"    edit-fn="nodeEdit"   efn="nodeEdit" node-id="role_id" node-children="_child" node-label='role_name' id="lt"></div>
        </div>
    </div>
</div>
<!-- 新增岗位弹出层 -->
<div class="ui role add modal">
    <i class="close icon"></i>
    <div class="header_h4">
        添加岗位
    </div>
    <div class="content">
        <form action="#" name="frm-add" id="frm-add" style="width:94%;margin-left:3%;">
            <div class="ui form">
                    <div class="inline field required">
                        <label class="two wide field">岗位名称</label>
                        <input type="text" name="add[role_name]" ng-model="add_data.role_name" placeholder="请输入岗位名称">
                    </div>
                    <div class="inline field required">
                        <label class="two wide field">上级岗位</label>
                        <div class="ui selection dropdown"  >
                            <input type="hidden" name="add[parent_role]" ng-model="add_data.parent_role" >
                            <div class="default text">默认为你的岗位</div>
                            <i class="dropdown icon"></i>
                            <div class="menu" >
                                <div class="item" data-value="{{vitem.role_id}}" ng-repeat="vitem in roles|tree2Arr:'_child'" >{{vitem.rep}}{{vitem.role_name}}</div>
                            </div>
                        </div>
                    </div>
                    <div class="inline fields">
                        <label class="two wide field">绑定权限</label>
                        <label class="checkbox-inline" ng-repeat="(k,v) in pageParam.rights">
                            <input type="checkbox" name="add[rights][]"  ng-click="addchk(k)" >{{v.right_name}}
                        </label>
                    </div>
                    <div class="inline field">
                        <label class="two wide field">备注信息</label>
                        <input type="text" name="add[info]"  ng-model="add_data.info" class="seven wide field" placeholder="岗位信息备注">
                    </div>
                    <div class="inline field required">
                    <label class="two wide field">所属部门</label>
                    <div class="ui selection dropdown" >
                        <input type="hidden" name="add[sector_id]"  ng-model="add_data.sector_id">
                        <div class="default text">默认为你的部门</div>
                            <i class="dropdown icon"></i>
                            <div class="menu" >
                                <div class="item" data-value="{{vitem.sector_id}}" ng-repeat="vitem in pageParam.sectors|tree2Arr:'_child'" >{{vitem.rep}}{{vitem.sector_name}}</div>
                            </div>
                    </div>
                    </div>
            </div>
        </form>
    </div>
    <div class="actions ">
        <button class="ui green button positive">{{'BTN_OK' | translate}}</button>
        <button class="ui grey button negative">{{'BTN_CANCEL' | translate}}</button>
    </div>
</div>
<!-- //新增岗位弹出层 -->

<!-- 编辑岗位弹出层 -->
<div class="ui role edit modal">
    <i class="close icon"></i>
    <div class="header_h4">
        修改岗位信息
    </div>
    <div class="content">
        <form action="#" name="frm-edit" id="frm-edit" style="width:94%;margin-left:3%;">
                <div class="ui form">
                        <div class="inline field required">
                            <label class="two wide field">岗位名称</label>
                            <input type="text" name="edit[role_name]" ng-model="edit_data.role_name" placeholder="请输入岗位名称">
                        </div>
                        <div class="inline field required">
                            <label class="two wide field">上级岗位</label>
                            <div class="ui selection dropdown">
                                <input type="hidden" name="edit[parent_role]" ng-model="edit_data.parent_role" >
                                <div class="default text">默认为你的岗位</div>
                                    <i class="dropdown icon"></i>
                                    <div class="menu" >
                                        <div class="item" data-value="{{vitem.role_id}}" ng-repeat="vitem in roles|tree2Arr:'_child'" >{{vitem.rep}}{{vitem.role_name}}</div>
                                    </div>
                            </div>
                        </div>
                        <div class="inline fields">
                            <label class="two wide field">绑定权限</label>
                            <label class="checkbox-inline" ng-repeat="(k,v) in pageParam.rights">
                                <input type="checkbox" name="edit[rights][]"  value="{{v.right_id}}" ng-click="editchk(k)" >{{v.right_name}}
                            </label>
                        </div>
                        <div class="inline field">
                            <label class="two wide field">备注信息</label>
                            <input type="text" name="edit[info]"  ng-model="edit_data.info" class="seven wide field" placeholder="岗位信息备注">
                        </div>
                        <div class="inline field required">
                        <label class="two wide field">所属部门</label>
                        <div class="ui selection dropdown">
                            <input type="hidden" name="edit[sector_id]"  ng-model="edit_data.sector_id">
                            <div class="default text">默认为你的部门</div>
                                <i class="dropdown icon"></i>
                                <div class="menu" >
                                    <div class="item" data-value="{{vitem.sector_id}}" ng-repeat="vitem in pageParam.sectors|tree2Arr:'_child'" >{{vitem.rep}}{{vitem.sector_name}}</div>
                                </div>
                        </div>
                      </div>
                </div>
            </form>
    </div>
    <div class="actions ">
        <button class="ui green button positive">{{'BTN_OK' | translate}}</button>
        <button class="ui grey button negative">{{'BTN_CANCEL' | translate}}</button>
    </div>
</div>
<!-- //编辑岗位弹出层 -->

<script type="text/javascript">
    $(function(){
        $('.ui.dropdown').dropdown();
        $('.ui.radio.checkbox').checkbox();
        $('#frm-add').form({
            inline:true,
            on: 'blur',
            fields: {
                role_name: {
                    identifier: 'add[role_name]',
                    rules: [
                      {
                        type   : 'empty',
                        prompt : '新增岗位名称不能为空'
                      }
                    ]},
                parent_role:{
                    identifier: 'add[parent_role]',
                    rules: [
                      {
                        type:'empty',
                        prompt:'上级岗位不能为空'
                      }
                    ]},
                sector_id:{
                    identifier:'add[sector_id]',
                    rules: [
                      {
                        type:'empty',
                        prompt:'岗位所属部门不能为空'
                      }
                    ]}
            }
        });

        $('#frm-edit').form({
            inline:true,
            on: 'blur',
            fields: {
              role_name: {
                identifier: 'edit[role_name]',
                rules: [
                  {
                    type   : 'empty',
                    prompt : '新增岗位名称不能为空'
                  }
                ]},
                parent_role:{
                identifier: 'edit[parent_role]',
                rules: [
                  {
                    type:'empty',
                    prompt:'上级岗位不能为空'
                  }
                ]},
            }
        });
    });
</script>